package com.ghovos.usermangerpgdemo.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.util.ArrayList;
import java.util.List;

/**
 * 用户表
 * @author liuli
 */
@EqualsAndHashCode(callSuper = true)
@Data
@ApiModel(description = "用户实体")
@TableName("tb_user")
public class UserEntity extends BaseEntity{
    /**自增*/
    @TableId(type = IdType.AUTO)
    @ApiModelProperty(value = "id")
    protected Long id;
    @ApiModelProperty(value = "用户名")
    private String username;

    /** 隐藏密码*/
    @JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
    @ApiModelProperty(value = "密码")
    private String password;
    @ApiModelProperty(value = "部门id")
    private Long departmentId;
    @TableLogic
    private String isDeleted;

    @TableField(exist = false)
    private List<RoleEntity> roleEntities = new ArrayList<>();

    @TableField(exist = false)
    private DepartmentEntity departmentEntity;
}
